package com.gopay.common.constants.riskcontrol;

import java.util.HashMap;
import java.util.Map;

/**
 * 风控管理 常量
 * @RiskControlConstants.java
 * @author dongdh
 * @2016年1月19日 下午11:02:46  www.gopay.com.cn Inc.All rights reserved.
 */
public class RiskControlConstants {

    ///启用 禁用状态
    public static final String COM_RULE_STAT_ENABLE = "01"; //启用
    public static final String COM_RULE_STAT_DISABLE = "02"; //禁用
    
    //处理方式
    public static final String DEAL_TYPE_THROUGH_AND_SUSPICIOUS = "01"; //通过可疑
    public  static final String DEAL_TYPE_REFUSED = "02"; //拒绝，阻断
    public  static final String DEAL_TYPE_ARTIFIAUDIT = "03"; //人工审核
    public static final String DEAL_TYPE_LOCK_PAY = "04"; //付款锁定
    public static final String DEAL_TYPE_EXPORT_DETAIL = "05"; //导出交易明细
    public static final String DEAL_TYPE_SUSPICIOUS_BEHAVIOR = "06"; //可疑行为
    public static final String DEAL_TYPE_CUST_LOCKED = "07"; //客户状态锁定
    public static final String DEAL_TYPE_REPORT_ANTI_PLATFORM = "08"; //上报反诈骗平台
    public static final String DEAL_TYPE_SMS_NOTIFY = "09"; //短信通知
    public static final String DEAL_TYPE_PASS_MODEL = "10"; //通过(这里指通过风险模型)
    
    //阈值类型
    public static final String THRESHOLD_TYPE_CYCLE = "0"; //周期
    public static final String THRESHOLD_TYPE_SINGLE = "1"; //单笔
    
    //阈值是否启用
    public static final String THRESHOLD_STAT_DISABLE = "0"; //禁用
    public static final String THRESHOLD_STAT_ENABLE = "1"; //启用

    //风险名单类型
    public static final String RCLISTING_GREY= "01";//灰名单
    public static final String RCLISTING_BLACK = "02";//黑名单
    public static final String RCLISTING_WHITE= "03";//钱包白名单
    public static final String RCLISTING_RISK_WHITE= "04";//风控白名单
    //风险名单状态
    public static final String RCLISTING_ACTIVE= "01";//激活
    public static final String RCLISTING_DEL = "02";//移除

    //黑名单移除类型
    public static final String MOVE_TYPE_AUTO = "1"; // 自动
    public static final String MOVE_TYPE_ARTIFICIAL = "2"; // 手动

    //规则类型
    public static final String RULE_TYPE_COM = "01";//通用
    public static final String RULE_TYPE_SYS = "02";//系统

    public static final String SYS_RULE_G0001 = "G0001";//系统规则G0001代码
    public static final String SYS_RULE_G0002 = "G0002";
    public static final String SYS_RULE_G0003 = "G0003";
    public static final String SYS_RULE_G0004 = "G0004";
    public static final String SYS_RULE_G0005 = "G0005";
    public static final String SYS_RULE_G0006 = "G0006";
    public static final String SYS_RULE_G0007 = "G0007";
    public static final String SYS_RULE_G0008 = "G0008";
    public static final String SYS_RULE_G0009 = "G0009";
    public static final String SYS_RULE_G0010 = "G0010";
    public static final String SYS_RULE_G0011 = "G0011";
    
    //反诈骗上报系统规则
    public static final String SYS_RULE_G0012 = "G0012";
    public static final String SYS_RULE_G0013 = "G0013";
    public static final String SYS_RULE_G0014 = "G0014";
    
    public static final String RULE_GRAY_CORP_HG0001 = "HG0001";
    public static final String RULE_GRAY_CORP_HG0002 = "HG0002";

    //账户预设额度校验规则
    public static final String DEFAULT_LIMIT_HG0004 = "HG0004";  //账户余额
    public static final String DEFAULT_LIMIT_HG0005 = "HG0005";  //累计发起交易次数
    public static final String DEFAULT_LIMIT_HG0006 = "HG0006";  //累计发起交易成功次数

    // 处理方式
    public static final String DEAL_TYPE_TO_BANK_BLACKLIST = "1"; //加入银行卡黑名单
    public static final String DEAL_TYPE_TO_LOCK_CUST = "2"; //用户锁定
    public static final String DEAL_TYPE_ENABLED = "1"; //处理方式启用
    public static final String IS_SELF = "1";

    // 客户类型
    public static final String RCLISTING_PERS = "1"; //个人
    public static final String RCLISTING_CORP = "2"; //企业

    //通用规则审核状态
    public static final String COM_RULE_AUDIT_STAT_NEED_AUDIT = "01";
    public static final String COM_RULE_AUDIT_STAT_OK_AUDIT = "02";
    public static final String COM_RULE_AUDIT_STAT_REFUSED_AUDIT = "03";


    //日志表操作类型
    public static final String LOG_OPTYPE_ADD = "01";
    public static final String LOG_OPTYPE_UPD = "02";
    public static final String LOG_OPTYPE_AUDIT_OK = "03";
    public static final String LOG_OPTYPE_AUDIT_REFUSED = "04";
    public static final String LOG_OPTYPE_STAT_ENANBLE = "05";
    public static final String LOG_OPTYPE_STAT_DISABLE = "06";
    public static final String LOG_OPTYPE_DEL = "07";


    //日志表目标类型 类型
    public static final String LOG_TARGET_TYPE_COM_RULE_AUDIT = "01"; //通用规则审核
    /** add by 反诈骗管理平台   baiyunpeng   20161111 start*/
    public static final String FRAUD_ACC_LOCK_TYPE = "01";//锁定类型
    public static final String FRAUD_ACC_FREZE_TYPE = "02";//冻结类型
    public static final String FRAUD_ACC_UNFREZE_TYPE = "03";//解冻类型
    public static final String FRAUD_ACC_UNLOCK_TYPE = "04";//解锁类型
    public static final String FRAUD_ARTIFICIAL_OPERATION = "01";//人工
    public static final String FRAUD_OUTSIDE_OPERATION = "02";//反诈骗
    /** add by 反诈骗管理平台   baiyunpeng   20161111 start*/
    public static final String FRAUD_DEFAULTLIMIT_OPERATION = "03";//预设额度
    /** add by 跨境人民币外卡支付 lailingyu 20171102 */
    public static final String FRAUD_INTLCARD_REFUND_OPERATION = "04";//外卡支付退款解冻/冻结保证金
    /** add by 跨境人民币外卡支付拒付 lailingyu 20180122 */
    public static final String FRAUD_INTLCARD_DISHONOR_OPERATION = "05";//外卡支付拒付冻结/解冻保证金

    public static final String RECV_INT_TXN_CD = "00100,00500,00666"; //收款类交易码

    public static final String PAY_INT_TXN_CD = "00700,00800,00900";//付款类交易码

    private static Map<String, String> custTypeMap = new HashMap<String, String>();
    private static Map<String, String> isRealNameCertifyMap = new HashMap<String, String>();
    private static Map<String, String> typeMap = new HashMap<String, String>();
    private static Map<String, String> statMap = new HashMap<String, String>();
    private static Map<String, String> moveTypeMap = new HashMap<String, String>();
    private static Map<String, String> cardTypeMap = new HashMap<String, String>();

    static {
        /** 个人 */
        custTypeMap.put("1", "个人");
        /** 企业 */
        custTypeMap.put("2", "企业");
        /** 未实名未认证 */
        isRealNameCertifyMap.put("0", "未实名未认证");
        /** 已实名已认证 */
        isRealNameCertifyMap.put("1", "已实名已认证");
        /** 已实名未认证 */
        isRealNameCertifyMap.put("2", "已实名未认证");
        /** 周期 */
        typeMap.put("0", "周期");
        /** 单笔 */
        typeMap.put("1", "单笔");
        /** 禁用 */
        statMap.put("0", "禁用");
        /** 启用 */
        statMap.put("1", "启用");
        /** 自动 */
        moveTypeMap.put("1", "自动");
        /** 手动 */
        moveTypeMap.put("2", "手动");
        /** 借记卡 */
        cardTypeMap.put("0", "借记卡");
        /** 信用卡 */
        cardTypeMap.put("1", "信用卡");
    }
    
    /**
     * 翻译用户类型
     * 
     * @param custType
     * */
    public static String getCustType(String custType) {
        String ret = custTypeMap.get(custType);
        return isNotBlank(ret) ? ret : "未知";
    }
    
    /**
     * 翻译实名状态
     * 
     * @param isRealNameCertify
     * */
    public static String getIsRealNameCertify(String isRealNameCertify) {
        String ret = isRealNameCertifyMap.get(isRealNameCertify);
        return isNotBlank(ret) ? ret : "未知";
    }
    
    /**
     * 翻译阈值类型
     * 
     * @param type
     * */
    public static String getType(String type) {
        String ret = typeMap.get(type);
        return isNotBlank(ret) ? ret : "未知";
    }
    
    /**
     * 翻译启用状态
     * 
     * @param stat
     * */
    public static String getStat(String stat) {
        String ret = statMap.get(stat);
        return isNotBlank(ret) ? ret : "未知";
    }

    /**
     * 卡类型
     * @param stat
     * @return
     */
    public static String getCardType(String stat) {
        String ret = cardTypeMap.get(stat);
        return isNotBlank(ret) ? ret : "未知";
    }

    /**
     * 翻译移除类型
     * @param stat
     * @return
     */
    public static String getMoveType(String stat) {
        String ret = moveTypeMap.get(stat);
        return isNotBlank(ret) ? ret : "未知";
    }
    
    public static boolean isNotBlank (String s) {
        if (null != s ) {
            return true;
        }
        return false;
    }

}
